/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit;

import picounit.Registry.ImplementationCapturer;

public class DelegatingImplementationCapturer<B> implements ImplementationCapturer<B> {
	private ImplementationCapturer<B> delegate;

	public DelegatingImplementationCapturer(Class<B> baseClass, Registry delegate) {
		this.delegate = delegate.registerFactory(baseClass);
	}

	public <D extends B> ImplementationCapturer<B> add(Class<D> implementation) {
		delegate = delegate.add(implementation);
		
		return this;
	}

	public <D extends B> ImplementationCapturer<B> add(D instance) {
		delegate = delegate.add(instance);

		return this;
	}

	public void done() {
		delegate.done();
	}
}
